<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Decomposing Attributed Variables
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot097.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot093.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot099.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc222">16.5</A>&nbsp;&nbsp;Decomposing Attributed Variables</H2>
The attributes of an attributed variable can be accessed using one-way
unification in a matching clause, e.g.
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
    get_attribute(X{Name:Attribute}, A) :-
        -?-&gt;
        A = Attribute.
</PRE></BLOCKQUOTE>
This clause succeeds only when the first argument is an attributed variable,
and it binds
<TT>X</TT> to the whole attributed variable and <TT>A</TT> to the attribute
with name <TT>Name</TT>.
Note that a normal (unification) clause can <B>not</B> be used to decompose
an attributed variable (it would create a new attributed variable and unify this with the caller
argument, but the unification is handled by an attributed variable handler, see
Section <A HREF="umsroot100.html#metahandlers">16.7</A>).<BR>
<BR>
<HR>
<A HREF="umsroot097.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot093.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot099.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
